package hbase.mapReduce;

import java.io.IOException;

import org.apache.hadoop.hbase.client.Result;
import org.apache.hadoop.hbase.io.ImmutableBytesWritable;
import org.apache.hadoop.hbase.mapreduce.TableMapper;
import org.apache.hadoop.io.IntWritable;

public class Mapper{
	static class Mapper1 extends TableMapper<ImmutableBytesWritable, IntWritable> {
		private int numRecords = 1;
		private static final IntWritable one = new IntWritable(1);

		@Override
		public void map(ImmutableBytesWritable row, Result values, Context context) throws IOException {
			ImmutableBytesWritable dateKey = new ImmutableBytesWritable(row.get());
			try {
				context.write(dateKey, one);
			} catch (InterruptedException e) {
				throw new IOException(e);
			}
			numRecords++;

			//System.out.println("mapper processed " + numRecords + " records so far");

		}
	}
}